/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test;

import calculator.Calculator;
import calculator.CrowflightCalculator;
import calculator.DistanceTableCalculator;
import dao.*;
import hibernate.entityes.*;
import java.nio.charset.Charset;
import java.util.List;

/**
 *
 * @author eleven
 */
public class Main {

    public static void main(String[] args) {
        CityDAO daocity = DAOFactory.getHibernateDAOFactory().getCityDAOImpl();

        daocity.saveElement(new City("Самара", 53.14, 50.10));
        daocity.saveElement(new City("Омск", 54, 59));
        daocity.saveElement(new City("Липецк", 52, 37));
        daocity.saveElement(new City("Саратов", 51.33, 46.0));

        DistanceDAO daodistance = DAOFactory.getHibernateDAOFactory().getDistanceDAOImpl();

        daodistance.saveElement(new Distance(new DistancePK("Самара", "Саратов"), 431000));

        Calculator calc = new CrowflightCalculator();
        System.out.println("Crowflight distance = " + calc.calculate("Самара", "Саратов"));

        Calculator calc1 = new DistanceTableCalculator();
        System.out.println("Crowflight distance = " + calc1.calculate("Самара", "Саратов"));
    }
}
